package com.capgemini.fs.presentation.user.web.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.capgemini.fs.app.ekms.model.Group;
import com.capgemini.fs.app.ekms.model.Role;
import com.capgemini.fs.app.ekms.service.GroupService;
import com.capgemini.fs.app.ekms.service.RoleService;

public class CreateUserPageAction extends Action{

	
	private RoleService createUserPageRoleService;
	public RoleService getCreateUserPageRoleService() {
		return createUserPageRoleService;
	}
	public void setCreateUserPageRoleService(RoleService createUserPageRoleService) {
		this.createUserPageRoleService = createUserPageRoleService;
	}
	public GroupService getCreateUserPageGroupService() {
		return createUserPageGroupService;
	}
	public void setCreateUserPageGroupService(
			GroupService createUserPageGroupService) {
		this.createUserPageGroupService = createUserPageGroupService;
	}
	private GroupService createUserPageGroupService;
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response){
//		System.out.println(form);
		List<Role> roleList = createUserPageRoleService.getAllRoles();
		HttpSession session1 = request.getSession();
		session1.setAttribute("roleList", roleList);
//		System.out.println("+++++++++"+roleList);
		List<Group> groupList = createUserPageGroupService.findAllGroup();
		session1.setAttribute("groupList", groupList);
		return mapping.findForward("suc");
	}
}
